package main;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

import security.Licence;
import user.UserCheck;

@Entity
@Table(name="service")
public class Service {
	@Column(name="SERVICENAME", length=50)
	private String serviceName;
	@Id
	@Column(name="SERVICEURI", length=200)
	private String serviceURI;
	@ManyToMany(mappedBy="availableServices")
	private List<Licence> licences = new ArrayList<Licence>();
	@OneToOne
	@PrimaryKeyJoinColumn
	private UserCheck usercheck;
	
	public Service() {
	}
	
	public Service(String serviceName, String serviceURI){
		this.serviceName = serviceName;
		this.serviceURI = serviceURI;
	}
	
	public void setServiceName(String serviceName) {
		// TODO Auto-generated method stub
		this.serviceName=serviceName;
	}

	public void setServiceURI(String serviceURI) {
		// TODO Auto-generated method stub
		this.serviceURI=serviceURI;
	}

	public String getServiceName() {
		return serviceName;
	}

	public String getServiceURI() {
		return serviceURI;
	}

	public List<Licence> getLicences() {
		return licences;
	}

	public void setLicences(List<Licence> licences) {
		this.licences = licences;
	}
	
	public void addLicence(Licence licence){
		this.licences.add(licence);
	}
	
	public void removeLicence(Licence licence){
		this.licences.remove(licence);
	}

	public UserCheck getUsercheck() {
		return usercheck;
	}

	public void setUsercheck(UserCheck usercheck) {
		this.usercheck = usercheck;
	}
	
}
